/*
 * Created on 2006-2-22
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package cn.com.sbell.vss.csg.vap;

import org.dom4j.Element;

import cn.com.sbell.vss.VssConstants;
import cn.com.sbell.vss.VssException;
import cn.com.sbell.vss.csg.vap.bean.ImageAdjustingInfo;
import cn.com.sbell.vss.csg.vsclient.VsClient;
import cn.com.sbell.vss.csg.vsclient.util.PropertiesHolder;

/**
 * @author liang.a.chen
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class GetVsImageAdjusting extends ProtectedVsCommander {

	protected Element executeCommand(VsClient vsClient, PropertiesHolder holder, Element root) {
		Integer videoId = holder.getIntProperty("videoId");
		if(videoId == null){
			throw new VssException(VssConstants.CODE_REQUIRED,new String[]{"csg.videoId"});
		}
		ImageAdjustingInfo imageInfo = vsClient.getImageAdjustingInfo(videoId.intValue());
		
		root.addElement("videoId").addText(toString(imageInfo.getVideoId()));
		root.addElement("contrast").addText(toString(imageInfo.getContrast()));
		root.addElement("bright").addText(toString(imageInfo.getBright()));
		root.addElement("hue").addText(toString(imageInfo.getHue()));
		root.addElement("saturation").addText(toString(imageInfo.getSaturation()));
		
		return root;
	}
}
